﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Cryptography;
using System.Web.Security;
using System.Text;
using LogicLevel;

namespace WebLevel
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            string password = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(TB_PASSWORD.Text)), 4, 8).ToLower().Replace("-", "");
            int userId = UserMethod.userLogin(TB_EMAIL.Text, password);
            if (userId > 0)
            {
                Session["userID"] = userId;
                Response.Redirect("/Homepage.aspx");
            }
            
        }
    }
}